package com.qf.listener;

import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.stereotype.Component;

public class MySAR implements SpringApplicationRunListener {

    public MySAR(SpringApplication sa,String[] args){

    }

    @Override
    public void starting(ConfigurableBootstrapContext bootstrapContext) {
        System.out.println("springboot 正在启动");
    }

    @Override
    public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext, ConfigurableEnvironment environment) {
        System.out.println("springboot env环境准备完成");
    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {
        System.out.println("springboot 上下文 准备完成");
    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {
        System.out.println("springboot 上下文 加载完成");
    }

    @Override
    public void started(ConfigurableApplicationContext context) {
        System.out.println("springboot 启动完成");
    }

    @Override
    public void running(ConfigurableApplicationContext context) {
        System.out.println("springboot 正在运行");
    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        System.out.println("springboot 启动失败");
    }
}
